package com.itm.lqm.service;

import java.util.List;





import com.itm.lqm.dao.StudentDao;
import com.itm.lqm.entity.Student;


public class StudentService {
StudentDao pd=new StudentDao();
//业务逻辑层，校验
	//查询所有学生
	public List<Student> findAllStudent(){
		List<Student> list=pd.findAllStudent();
		return list;
	}
	//按照班级查询学生
	public List<Student> findStudentByClas(String clas) {
		List<Student> list=pd.findStudentByClas(clas);
		return list;
	}
	
	
	//根据sid查询学生
	public Student findStudentBySid(int sid){
		Student s=pd.findStudentBySid(sid);
		return s;
	}	
	
	
	//添加学生
	public boolean addStudent(Student sid){
		if(!pd.isExistSid((sid.getSid()))){
			pd.addStudent(sid);
			return true;
		}else{
			System.out.println("此学生已存在");
			return false;
		}
		
	}
	
	
	//删除学生
		public boolean deleteStudentBySno(int sid){
			if(pd.isExistSid(sid)){
				pd.deleteStudent(sid);
				return true;
			}else{
				return false;
			}
		}
		//修改学生
		public boolean  updateStudent(Student s){
			if(pd.isExistSid(s.getSid())){
				pd.updateStudent(s);
				return true;
			}else{
				return false;
			}
		}
		
	
	
	
	
	

}
